﻿//*****************************************************************************
//
//  Copyright 2008 IT Cloud Company
//
//  This software is available under the Microsoft Public License.  Please
//  read the license agreement at http://opensource.org/licenses/ms-pl.html
//  before using the software.
//
//  Authors:
//    Don Song (don@itcloud.com)
//
//*****************************************************************************

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace HeadLinx.AD.Explorer
{
    public class HeadLinxTreeNode
    {
        private HeadLinxTreeNodeCollection _children = new HeadLinxTreeNodeCollection();
        private FrameworkElement _content;
        private double _treeWidth;
        private double _treeHeight;
        private double _maxSiblingHeight = 0.0;

        public HeadLinxTreeNodeCollection Children
        {
            get
            {
                return _children;
            }
        }

        public double Height
        {
            get
            {
                return _content.ActualHeight;
                //return _content.Height;
            }
        }

        public double Width
        {
            get
            {
                return _content.ActualWidth;
                //return _content.Width;
            }
        }

        public double Left
        {
            get
            {
                return Canvas.GetLeft(_content);
            }
            set
            {
                Canvas.SetLeft(_content, value);
            }
        }

        public double Top
        {
            get
            {
                return Canvas.GetTop(_content);
            }
            set
            {
                Canvas.SetTop(_content, value);
            }
        }

        public double TreeWidth
        {
            get
            {
                return _treeWidth;
            }
            set
            {
                _treeWidth = value;
            }
        }

        public double TreeHeight
        {
            get
            {
                return _treeHeight;
            }
            set
            {
                _treeHeight = value;
            }
        }

        public double MaxSiblingHeight
        {
            get
            {
                return _maxSiblingHeight;
            }
            set
            {
                _maxSiblingHeight = value;
            }
        }

        public FrameworkElement Content
        {
            get
            {
                return _content;
            }
            set
            {
                _content = value;
            }
        }
    }

    public class HeadLinxTreeNodeCollection : Collection<HeadLinxTreeNode>
    {
    }
}
